package interpreter;

import interpreter.interf.Expression;

import java.util.HashSet;
import java.util.Set;

/**
 * 【终结符表达式类】
 *
 * @Author: luanxd
 * @Date: 2021-07-06 10:32
 */
public class TerminalExpression implements Expression {

    private Set<String> set = new HashSet<String>();

    public TerminalExpression(String[] data) {
        for (int i = 0; i < data.length; i++) {
            set.add(data[i]);
        }
    }

    /**
     * 解释方法
     *
     * @param info
     */
    public boolean interpret(String info) {
        if (set.contains(info)) {
            return true;
        }
        return false;
    }
}
